-
Notifications
You must be signed in to change notification settings - Fork 72
feat: Impl InMemoryCatalog's UpdateTable #386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
55d3900 to
67a5362
Compare
zhjwpku
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| const std::vector<std::unique_ptr<TableRequirement>>& requirements, | ||
| const std::vector<std::unique_ptr<TableUpdate>>& updates) { | ||
| return NotImplemented("update table"); | ||
| std::unique_lock lock(mutex_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| std::unique_lock lock(mutex_); | |
| std::lock_guard guard(mutex_); |
Use std::lock_guard instead of std::unique_lock if we don't need to move the guard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it can be optimized with ReadWriteLock later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that we may be able to replace the lock type with std::shared_lock. If you don't do that in this PR, I hope that you can replace with std::lock_guard first. Because we have merged a PR #398 which replaced the other unique_lock in this file.
| return TableMetadataFromJson(json); | ||
| } | ||
|
|
||
| Status TableMetadataUtil::Write(FileIO& io, const TableMetadata* base, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using reference instead of raw pointer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The base can be nullptr, indicating that this is creating a new table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can turn metadata into reference.
| /// \return The file extension of the codec. | ||
| static std::string CodecTypeToFileExtension(MetadataFileCodecType codec); | ||
|
|
||
| inline static constexpr std::string_view kTableMetadataFileSuffix = ".metadata.json"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static constexpr is implicitly inline and we can remove inline here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's implicitly inline in c++20+, It's recommended to explicitly define as inline in my previous PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry that I have no time last week so I didn't review your previous PR. This project is under at least C++23, so we don't need inline to avoid ODR violations.
No description provided.